<template>
	<view :style="themeColor">
		<view class="page">
			<view
				class="flex flex-direction flex-wrap align-stretch justify-center benben-position-layout flex inputNewPhone_flex_0"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
				<view class='flex flex-wrap align-stretch justify-between inputNewPhone_fd0_0'>
					<view class='flex flex-wrap align-center inputNewPhone_fd0_0_c0' @tap.stop="handleJumpDiy"
						data-type="back" data-url="1">
						<text class='fu-iconfont2  inputNewPhone_fd0_0_c0_c0'>&#xe794;</text>
					</view>
					<view class='flex flex-wrap align-center'>
						<text class='inputNewPhone_fd0_0_c1_c0'>绑定新手机</text>
					</view>
					<view class='flex align-center justify-end inputNewPhone_fd0_0_c2'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---输入新的手机号-表单flex布局开始-->
			<view class="flex flex-direction flex-wrap align-stretch inputNewPhone_flex_1">
				<view class='flex flex-wrap align-center inputNewPhone_fd1_0'>
					<image class='inputNewPhone_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"52.png"'></image>
					<benben-input class='flex-sub inputNewPhone_fd1_0_c1' type="number" :focus='true'
						:placeholder="`请输入手机号`" confirm-type="done" :maxlength="11"
						placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="mobile" />
				</view>
				<view class='flex flex-wrap align-center inputNewPhone_fd1_0'>
					<image class='inputNewPhone_fd1_0_c0' mode="aspectFit" :src='STATIC_URL+"53.png"'></image>
					<benben-input class='flex-sub inputNewPhone_fd1_1_c1' type="number" :placeholder="`请输入验证码`"
						confirm-type="done" :maxlength="6"
						placeholder-style="color:rgba(191, 191, 191, 1);font-size:32rpx" v-model="code" />
					<benben-send-verification-code key='1686921342261' ref="vCode1686921342261"
						class=' inputNewPhone_fd1_1_c2' after-text='后重新获取' before-text='获取验证码' type='5'
						:phone="mobile"></benben-send-verification-code>
				</view>
				<button class='flex-sub inputNewPhone_fd1_2' @tap.stop="checkCodeFunc()">提交</button>
			</view>

			<!---输入新的手机号-表单flex布局结束-->


		</view>
	</view>
</template>
<script>
	import {
		validate
	} from '@/common/utils/validate.js'

	export default {
		components: {},


		data() {
			return {
				"mobile": "",
				"code": "",
				"userinfo": {
					"userinfo": {
						"id": "",
						"user_token": "",
						"avatar": "",
						"real_name": "",
						"nickname": "",
						"userlevel_id": "",
						"email": "",
						"gender": "",
						"mobile": "",
						"birthday": "",
						"phone": "",
						"user_type": "",
						"certified_status": "",
						"shopID": ""
					}
				},
				"userData": {
					"invite_code": "",
					"address": "",
					"address_code": "",
					"hobby": "",
					"tags": "",
					"id": "",
					"userlevel_id": "",
					"mobile": "",
					"real_name": "",
					"nickname": "",
					"avatar": "",
					"account": "",
					"email": "",
					"birthday": "",
					"gender": "",
					"create_time": "",
					"user_money": "",
					"freeze_money": "",
					"total_consumption_money": "",
					"score": "",
					"_mobile": "",
					"coupon": "",
					"collection_count": "",
					"browse_count": "",
					"total_money": "",
					"certified": "",
					"is_pay_password": "",
					"fuwuxingji": "",
					"gongzuozhuangtai": "",
					"shuzi": "",
					"jifen": "",
					"yajin": "",
					"level": {
						"aid": "",
						"name": "",
						"icon": "",
						"levelid": ""
					},
					"invite_num": "",
					"commission": "",
					"is_deposit": "",
					"is_account": "",
					"dengjidaoqishijian": "",
					"suozaidi": "",
					"huiyuanyue": "",
					"working_hours": "",
					"credit_score": "",
					"deposit": "",
					"deposit_switch": "",
					"withdrawal": "",
					"account_wx": "",
					"account_alipay": "",
					"account_bank": "",
					"joinin_state": "",
					"fid": "",
					"chinaarea_id": "",
					"city_status": "",
					"service_status": "",
					"remark": "",
					"deposit_money": "",
					"joinin_state_name": ""
				}
			};
		},
		computed: {
			themeColor() {
				return this.$store.getters.themeColor
			},

		},
		watch: {},
		onLoad(options) {
			this.getDataFunc()
		},
		onUnload() {

		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {

		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			//获取用户信息
			async getDataFunc() {
				//请求方法
				//数据验证

				let datauserData = await this.$api.get(global.apiUrls.post5c78c4772da97, {

				});

				if (datauserData.data.code != 1) {
					this.$message.info(datauserData.data.msg);
					return
				}
				let infouserData = datauserData.data;
				this.userData = infouserData.data

			},
			//校验
			async checkCodeFunc() {
				if (!validate(this.mobile, 'require')) {
					this.$message.info('请输入手机号');
					return false;
				}
				if (!validate(this.mobile, 'phone')) {
					this.$message.info('请输入正确的手机号');
					return false;
				}
				if (!validate(this.code, 'require')) {
					this.$message.info('请输入验证码');
					return false;
				}
				if (!validate(this.code, 'captcha')) {
					this.$message.info('请输入正确的验证码');
					return false;
				}
				//请求方法
				//数据验证

				let datauserinfo = await this.$api.dbPost(global.apiUrls.post5f6c915d69d1f, {
					mobile: this.mobile,
					code: this.code,
					type: '5'
				});
				if (!datauserinfo) return
				if (datauserinfo.data.code != 1) {
					this.$message.info(datauserinfo.data.msg);
					return
				}
				let infouserinfo = datauserinfo.data;
				this.userinfo = infouserinfo.data

				this.getDataFunc()
				uni.showToast({
					title: '修改成功',
					mask: true,
					icon: 'none',
					duration: 1500
				});
				setTimeout(() => {
					this.$urouter.switchTab(`/pages/tabBar/mys/mys`);
				}, 500)
			}
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: #fff;
		background-size: 100% auto;
	}

	.inputNewPhone_flex_0 {
		border-bottom: 1px solid #eee;
		background: #fff;
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background-size: 100% auto !important;
	}

	.inputNewPhone_fd0_0_c2 {
		padding: 0rpx 0rpx 0rpx 0rpx;
		width: 100rpx;
	}

	.inputNewPhone_fd0_0_c1_c0 {
		font-size: 36rpx;
		font-weight: 500;
		color: #333333;
		line-height: 50rpx;
	}

	.inputNewPhone_fd0_0_c0_c0 {
		font-size: 36rpx;
		font-weight: 400;
		color: #333;
	}

	.inputNewPhone_fd0_0_c0 {
		width: 100rpx;
	}

	.inputNewPhone_fd0_0 {
		padding: 0rpx 32rpx 0rpx 32rpx;
		line-height: 88rpx;
	}

	.inputNewPhone_flex_1 {
		background: #fff;
		font-size: 32rpx;
		background-size: 100% auto !important;
		padding: 0rpx 32rpx 0rpx 32rpx;
	}

	.inputNewPhone_fd1_2 {
		background: rgba(48, 144, 255, 1);
		border-radius: 44rpx 44rpx 44rpx 44rpx;
		font-size: 32rpx;
		color: #fff;
		height: 88rpx;
		line-height: 88rpx;
		width: 686rpx;
		margin: 80rpx 0rpx 0rpx 0rpx;
	}

	.inputNewPhone_fd1_1_c2 {
		background: rgba(246, 247, 249, 1);
		font-size: 24rpx;
		font-weight: 400;
		color: #333333;
		background-size: 100% auto;
		border-radius: 28rpx;
		padding: 0rpx 22rpx 0rpx 22rpx;
		line-height: 56rpx;
	}

	.inputNewPhone_fd1_1_c1 {
		color: #333;
		font-size: 32rpx;
		font-weight: 400;
	}

	.inputNewPhone_fd1_0_c1 {
		font-size: 28rpx;
		font-weight: 400;
		color: #333;
	}

	.inputNewPhone_fd1_0_c0 {
		width: 28rpx;
		height: 33rpx;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		margin: 0rpx 32rpx 0rpx 0rpx;
	}

	.inputNewPhone_fd1_0 {
		border-bottom: 1px solid #eee;
		padding: 32rpx 0rpx 32rpx 0rpx;
	}
</style>